package 
{
    import flash.events.*;
    import flash.display.*;
    import flash.media.*;
    import flash.net.*;
	import flash.geom.*;
	
	import Ball;
	import FPS;
	import ShiftingGradient;
	import GradientStatus;
	import PBGradient;

    public class GradientTest extends MovieClip {
		
		public var frameSpeed:int = 60;
		public var gb:MovieClip;
		public var numBalls:int = 1;
		public var shiftingGradient:ShiftingGradient;
		public var gradientStatus:GradientStatus;
		public var pbGradient:PBGradient;

        public function GradientTest() {
	
			stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;

			stage.frameRate = frameSpeed;
			
			gradientStatus = new GradientStatus();
			gradientStatus.x = 20;
			gradientStatus.y = 40;
			addChild(gradientStatus);
			
			// gb = MovieClip(getChildByName("gradientBg"));
			pbGradient = new PBGradient();
			addChildAt(pbGradient, 0);
			
			// Start up the FPS Counter
			var fpsCounter:FPS = new FPS();
			fpsCounter.x = fpsCounter.y = 20;
			addChild(fpsCounter);

			// Initial resize to bump everything into place
			resizeStage(null);
			stage.addEventListener(Event.RESIZE, resizeStage);
            
			// Start the cycling gradient animation
			// gb.gotoAndPlay(2);
			
			// Create the Ball(s)
			for (var i=0; i < numBalls; i++)
			{
				var newBall:Ball = new Ball(stage);
				addChild(newBall);
			}
        }

        public function resizeStage (evt:Event) : void 
		{
            // gb.width = stage.stageWidth;
            // gb.height = stage.stageHeight;

			pbGradient.width = stage.stageWidth;
	        pbGradient.height = stage.stageHeight;
        }
    }
}
